﻿using LNet;
using OestsCommon.Model;
using OestsServer.Net;

namespace OestsServer.Handlers.UnityHandlers
{
    public class StartSingelTaskHandler : HandlerBase<UnityClientChannel>
    {
        public override PacketKey PKey
        {
            get
            {
                return PacketKey.StartSingelTask;
            }
        }

        public override void Execute(UnityClientChannel client, Request packet)
        {
            int taskId = int.Parse(packet.DataStr);
            if (client.User.Type == UserType.Student)
            {
                //TaskModel task = TaskDAL.GetTaskById((int)client.ProjectType, taskId);//20190201-lym-注释：unity端开始实训任务
                //Student s = client.User as Student;
                ////  s.CurrenPattern = PatternType.Train;
                //s.CurrentTask = task;
                //List<PostTaskModel> models = PostTaskDAL.GetData();
                //foreach (var model in models)
                //{
                //	if (model.TaskId == task.Id)
                //	{
                //		PostModel p = PostDAL.GetPostModel(model.PostId);
                //		s.CurrentPost = p;
                //		break;
                //	}
                //}
                //反馈任务开始
                ResponsePacket.DataObject = taskId;
                client.Send(ResponsePacket);
            }
        }
    }
}
